valueForMirror in autogrow-textarea now replaces spaces with #112
valueForMirror in autogrow-textarea now replaces spaces with #112tyler-sommer wants to merge 1 commit intogooglearchive:masterfrom veonik:mirror-nbsp
Conversation
|
I am having this issue. I tried to apply the changes in https://github.com/veonik/paper-input/commit/4c3f2c20cc033bc104248d00ae6cf1e3e58ea51a but it ended up making it so the autogrow update method did not work. |
|
There are two bugs with this PR:
|
|
Also, please add tests :) |
|
Thanks for the feedback, @Arduinology and @morethanreal. I'll make some time in the next week or so to try and iron things out. Cheers! |
|
I found that just hiding the mirror with a |
|
@Arduinology The element is auto sized with the mirror since a text area doesn't auto resize (instead of scrolling) as you type. Making the mirror |
|
@morethanreal sorry I was mistaken. I did the following within paper-autogrow-textarea.html. This isn't perfect since currently this means every paper-autogrow-textarea requires an ID for this to work. .mirror-text {
visibility: hidden;
}I did the following (jquery) to update the height of any paper-autogrow-textarea's within the polymer ready callback. //check if element exists
if(($('paper-autogrow-textarea').length > 0)) {
$('paper-autogrow-textarea').each(function (index, el) {
// if the text area of the autogrow element has any text within...
if($('#'+$(el).attr('id')+' > textarea').html().length > 0) {
//update the element based on id
el.update(document.querySelector("#"+$(el).attr('id')+" > textarea"));
}
});
}I might be incorrect in understanding how these work but I am unsure what else to do when loading a number of pre-populated autogrow textareas. |
If a line starts with a space, the mirror does not offset properly.
This modifies the valueForMirror function to replace spaces with
.